#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long n,l,r;
int main()
{
	freopen("candy.in","r",stdin);freopen("candy.out","w",stdout);
	scanf("%lld%lld%lld",&n,&l,&r);
	r-=l/n*n;
	r=min(r,n-1);
	printf("%lld",r);
	return 0;
} 
